<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ page isELIgnored="false"%>
<%@ include file="../common/taglibs.jsp"%>
<%@ taglib prefix="s" uri="/struts-tags"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link href="${rootPath}/css/a.css" type="text/css" rel="stylesheet" />
<link href="${rootPath}/css/index.css" type="text/css" rel="stylesheet" />
<title>终端领用记录查询</title>

<script type="text/javascript"
	src="<s:url value="/js/jquery-1.3.2.js" />"></script>
<script type="text/javascript" src="<s:url value="/js/common.js" />"></script>
<script language="javascript" type="text/javascript"
	src="<s:url value="/js/My97DatePicker/WdatePicker.js"/>"></script>
<script type='text/javascript' src='<s:url value="/dwr/engine.js"/>'></script>
<script type='text/javascript' src='<s:url value="/dwr/interface/MccQuery.js"/>'></script>
<script type="text/javascript">
$(document).ready(function(){
      var orgCode=$("#orgCode").val();
      if(orgCode != 99){
      	//loadOCode();
      }

      $("#sub").click(function(){
         
         $("#importForm").attr("action","<%=basePath%>/tidRecord/queryTidRecord.ct");
		 $("#importForm").submit();
       
      });
      
  		
      
   });

   function loadOCode(){
        var orgCode = $("#orgCode").val();
		if (!orgCode) {
			return;
		}
		
		MccQuery.loadOCode(orgCode, function(sortSmall) {
			fillSelect_sort("accountNo", sortSmall);
		});
   }
	
	function fillSelect_sort(sid, address) {
	  		
				if (!address || !sid) {
					return;
				}
				var $select = $("#" + sid);
				$select.empty();
				
				
				for ( var i = 0; i < address.length; i++) {
					$select.append("<option value='"+address[i].CODE+"'>"
							+ address[i].NAME + "</option>");
					
				}
				
				
			var agenid = $('#agenid').val();
		     var accno = document.getElementById("accountNo");
		     for(var i=0;i<accno.options.length;i++){
			     if(agenid==accno.options[i].value){
				     accno.options[i].selected = true;
			     }
		     }
		}
</script>
</head>
<body>
	<div class="subpage">
		<s:form id="importForm" action="queryTerminalPosSN.ct" method="post"
			namespace="/terminal"  theme="simple">
			<div class="user_title">
				<h2 class="headline-inquires">
					POS收单运营管理平台<br />
					
				</h2>
			</div>
			<table width="100%" cellpadding="0" cellspacing="0" border="0"
				class="query_table">

				<tr>
					<td colspan="6" align="center">
						<h2 class="headline-inquires">
							终端领用记录查询<br /> <span class="sub-title"></span>
						</h2>

					</td>
				</tr>


				<tr>
					<td colspan="6">&nbsp;</td>
				</tr>
				
				

				<tr>
				
				   <td align="right" width="15%">申请类型：</td>
						<td>
							
							<s:select cssClass="queryWidth" name="searchCondition.askType"
								id="askType"  
								list="#{'1':'申请','2':'退回' }"/>
								
						</td>
						
					<td align="right" width="15%">机型：</td>
						<td>
							
							<s:select cssClass="queryWidth" name="searchCondition.posType"
								id="orgCode"
								list="#request.typeMap" listKey="key" listValue="value" headerKey="99" headerValue="不限"/>
								
						</td>
						
				</tr>
				<tr>
						
						<td align="right" width="15%">品牌：</td>
						<td>
							
							<s:select cssClass="queryWidth" name="searchCondition.posBrand"
								id="orgCode"
								list="#request.brandMap" listKey="key" listValue="value"  headerKey="99" headerValue="不限"/>
						</td>
						
					  <td align="right" width="15%">名称：</td>
						<td>
							
							<s:select cssClass="queryWidth" name="searchCondition.posName"
								id="orgCode"
								list="#request.nameMap" listKey="key" listValue="value"  headerKey="99" headerValue="不限"/>
								
						</td>
						
				</tr>
				

				<tr>
					<td colspan="6">&nbsp;</td>
				</tr>
				<tr>
					<td colspan="6" align="center"><div style="color: blue;">
							<s:actionmessage />
						</div>
						<div style="color: red;">
							<s:actionerror />
						</div></td>
				</tr>

				<tr>
					<td colspan="6" align="center">
					 <s:submit value="查询" id="sub" /> &nbsp;&nbsp;&nbsp;&nbsp; 
					
							</td>
				</tr>
				<tr>
					<td colspan="6">&nbsp;</td>
				</tr>
				<tr>
					<td colspan="6">&nbsp;</td>
				</tr>
			</table>
<table width="100%" cellpadding="0" cellspacing="0" border="0">

				<tr>
					<td colspan="6" align="center">
						<h2 class="headline-inquires">终端信息列表</h2>

					</td>
				</tr>
				<s:if
					test="#request.searchRsList != null && #request.searchRsList.size>0">
					<tr>
						<td align="left">&nbsp;&nbsp;&nbsp;&nbsp; <page:pageCount
								max_pages="11" totalPage="${requestScope.totalPage}"
								currentPage="${requestScope.currentPage}"
								action="${rootPath}/terminal/queryTerminalPosSN.ct?currentPage=" />

						</td>
					</tr>
				</s:if>
			</table>
		</s:form>
			<table id="tableList" width="130%" class="table">
				<thead>
					<tr>
					    <th>终端序列号</th>
						<th>商户号</th>
						<th>终端号</th>
						<th>所属代理商</th>
						<th>品牌</th>
						<th>机型</th>
						<th>名称</th>
						 <s:if test="#session.session_merchant.roleType!=\"03\" && #session.session_merchant.roleType!=\"15\" && #session.session_merchant.roleType!=\"16\"">
						    <th>所属机构</th>
						 </s:if>
						<th>是否已绑定</th>
						<th>是否已出库</th>
						<th>备注</th>
						<th>入库时间</th>
						<th>出库时间</th>
					</tr>
				</thead>
				<tbody>
					<s:iterator value="#request.searchRsList" status="stat" id="term">
							<tr class="<s:if test="#stat.index%2==0">tr_0</s:if>" >
							<td>
							 <s:property value="#term.serialNum"/>
							</td>
							<td>
							 <s:property value="#term.mercCode"/>
							</td>
							<td>
							 <s:property value="#term.termCode"/>
							</td>
							<td>
							 <s:property value="#term.agentName"/>
							</td>
							<td>
							 <s:property value="#term.posBrand"/>
							</td>
							<td>
							 <s:property value="#term.posType"/>
							</td>
							<td>
							 <s:property value="#term.posName"/>
							</td>
							 <s:if test="#session.session_merchant.roleType!=\"03\" && #session.session_merchant.roleType!=\"15\" && #session.session_merchant.roleType!=\"16\"">
						       <td>
								 <s:property value="#term.orgName"/>
								</td>
						     </s:if>
							
							<td align="center">
							 <s:property value="#term.isBind"/>
							</td>
							<td align="center">
							 <s:property value="#term.isUsed"/>
							</td>
							
							<td>
							 <s:property value="#term.remark"/>
							</td>
							<td>
							 <s:property value="#term.inDateStr"/>
							</td>
							<td>
							 <s:property value="#term.outDateStr"/>
							</td>
							
							
							</tr>
						</s:iterator>
				</tbody>
			</table>
	</div>
</body>
</html>